unit sal_frm;

{$mode objfpc}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, DbCtrls, datamodule1_frm;

type

  { Tsal }

  Tsal = class(TForm)
    btchiudi: TButton;
    btsalvasal: TButton;
    eddataeffemi: TDBEdit;
    eddataemicert: TDBEdit;
    eddataprevemi: TDBEdit;
    edimportoeffettivo: TDBEdit;
    edimportoprevisto: TDBEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    procedure btchiudiClick(Sender: TObject);
    procedure btsalvasalClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  sal: Tsal;

implementation

{ Tsal }

procedure Tsal.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
  CloseAction:=cafree;
end;

procedure Tsal.btchiudiClick(Sender: TObject);
begin
  close;
end;

procedure Tsal.btsalvasalClick(Sender: TObject);
begin
    if btsalvasal.Caption = 'Salva' then
     begin
       //asdasd
       datamodule1.zqsal.FieldByName('ID_OPERA_SAL').Value:=DataModule1.dslavori.DataSet.FieldByName('AN_OP_ID_OPERA').AsInteger;
       datamodule1.zqsal.FieldByName('IDPRELIMINARE').Value:=DataModule1.dslavori.DataSet.FieldByName('IDPRELIMINARE').AsInteger;
       datamodule1.zqsal.FieldByName('IDDEFINITIVO').Value:=DataModule1.dslavori.DataSet.FieldByName('IDDEFINITIVO').AsInteger;
       datamodule1.zqsal.FieldByName('IDESECUTIVO').Value:=DataModule1.dslavori.DataSet.FieldByName('IDESECUTIVO').AsInteger;
     end;
  DataModule1.zqsal.ApplyUpdates;
  DataModule1.zqsal.CommitUpdates;
    //aggiorna la griglia del preliminari
  DataModule1.dssal.DataSet.Refresh;
  Close;
end;

initialization
  {$I sal_frm.lrs}

end.

